<admintpl file="header"/>
<body class="J_scroll_fixed emoji emoji">
<div class="wrap J_check_wrap">
  <ul class="nav nav-tabs">
     <li class="active"><a href="{:U('Barter/index')}">兑换列表</a></li>
     <li><a href="{:U('Barter/statistics')}">兑换统计</a></li>
  </ul>
		<form class="well form-search" method="post" action="{:U('Barter/index')}">
			<div class="search_type cc mb10">
				<div class="mb10">
					<span class="mr20">
						兑换订单：
	              <select id="province"name="typeclass" class="normal_select index_select"> 
								<option value="0">全部</option>
		        		<foreach name="type" item="vo">
		        			<if condition="$formpost['typeclass'] eq $vo['typeID']">
			        			<option selected="selected" value="{$vo.typeID}">{$vo.typeName}</option>
			        			<else />
			        			<option value="{$vo.typeID}">{$vo.typeName}</option>
		        			</if>
		                </foreach>
	               	</select>
							&nbsp; &nbsp;&nbsp; &nbsp;时间：
							<input type="text" name="start_time" value="{$formpost.start_time}" class="J_date" style="width: 80px;">-
							<input type="text" name="end_time" value="{$formpost.end_time}" class="J_date" style="width: 80px;">
							订单ID：
							<input type="text" name="orderid" value="{$formpost.orderid}"  style="width: 80px;"> &nbsp; &nbsp;
							手机号：
							<input type="text" name="telephone" value="{$formpost.telephone}"  style="width: 80px;"> &nbsp; &nbsp;
							用户ID：
							<input type="text" name="userid" value="{$formpost.userid}"  style="width: 80px;"> &nbsp; &nbsp;
							<input type="submit" class="btn btn-primary" value="搜索" />
							<if condition="$num neq 0">
								共有 {$num} 条相关记录
							</if>
					</span>
				</div>
			</div>
		</form>
  <form class="form-horizontal J_ajaxForm" action="{:U('Barter/index')}" method="post">
    <div class="table_list">
      <div class="p10"><div class="pages"> {$Page} </div> </div>
      <table width="100%" class="table table-hover">
        <thead>
          <tr>
            <th width="60px">ID</th>
            <th>手机号</th>
            <th>ID：用户昵称</th>
            <th>商品ID</th>
            <th>兑换消耗</th>
            <th>下单时间</th>
            <th>订单状态</th>
            <th>订单详情</th>
          </tr>
        </thead>
        <foreach name="lists" item="vo">
        	<tr>
				<td>{$vo.id}</td>
				<td>{$vo.telephone}</td>
		        <td class='emoji'>
		        	{$vo.userid}：
	        		<foreach name="users" item="user">
	        			<if condition="$vo['userid'] eq $user['id']">
								<php> 
									$base64 = $user['nickname'];
							 	echo $base64 = preg_replace_callback ( '/@E(.{6}==)/', function ($r) {
												return base64_decode ( $r [1] );
										}, $base64 );
									$uid = $user['id'];
								</php>
	        			</if>
	          	</foreach>
            </td>
						<td><a href="{:U('shop/edit',array('id'=>$vo['itemid']))}">{$vo.itemid}</a></td>		
          	<td>{$vo.points}</td>		
						<td>{$vo.created}</td>
        		<td>
        			<foreach name="type" item="typ">
							<if condition="$typ['typeID'] eq $vo['status']">
									<if condition="$vo['status'] eq 150">
										<font color="#FF0150">{$typ.typeName}</font>
			        		</if>
									<if condition="$vo['status'] eq 160">
										<font color="#EAB65B">{$typ.typeName}</font>
			        		</if>
									<if condition="$vo['status'] eq 170">
										<font color="#008200">{$typ.typeName}</font>
			        		</if>
									<if condition="$vo['status'] neq 150 && $vo['status'] neq 160 && $vo['status'] neq 170">
									{$typ.typeName}
			        		</if>
		        		</if>
           		</foreach>
           	</td>
				<td>
					<a href="{:U('Barter/look',array('id'=>$vo['id']))}">订单内容</a>
				</td>
			</tr>
        </foreach>
      </table>
      <div class="p10"><div class="pages"> {$Page} </div> </div>
    </div>
  </form>
</div>
<script type="text/javascript" src="__ROOT__/statics/js/common.js"></script>
<script>
$('.emoji').emoji();
</script>
</body>
</html>